<?php


namespace app\facade;


class Facade
{
    /**
     * @var Cart
     */
    private $cart;

    /**
     * @var Order
     */
    private $order;

    /**
     * @var Pay
     */
    private $pay;

    public function __construct()
    {
        $this->cart = new Cart();
        $this->order = new Order();
        $this->pay = new Pay();
    }

    public function buy()
    {
        $this->cart->add('Iphone 12');
        $this->cart->add('porsche');
        $this->order->create('porsche');
        $this->pay->create('porsche');
    }

    public function cancel()
    {
        $this->order->cancel();
        $this->pay->refund();
    }
}